package com.ourteam.system.dao.impl;

import com.ourteam.system.dao.ISysRoleDAO;
import com.ourteam.system.dao.SysRole;
import com.ourteam.system.dao.SysRoleDAOQueryBean;

import net.dao.AbstractSpringDAO;
import net.dao.DataAccessObjectHelper;

import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.lang.StringUtils;

import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;


/**
 * Template Name : DAO服务对象
 * Template Version : 1
 * Template Last Modfiy Date : Fri Nov 17 11:00:11 CST 2017
 * Auto Generate Date : 2018-07-31 15:13:35
  * Warning ! This file will be overwrite when regenerate !
  *
 */
public class AbstractSysRoleDAOJdbcImpl extends AbstractSpringDAO
    implements ISysRoleDAO {
    public static final String[] ENTITY_FIELDS = new String[] {
            Id, DomainId, Remarks, RoleCode, RoleName, RoleType, Status,
            DefaultFlag, ModifyTime, OperatorId, OperatorName, DomainTitleKey,
            DomainName, DomainCode, DomainSortIndex, DomainIcon
        };
    public static final String[] ENTITY_PROPERTIES = new String[] {
            _DataObjectProperty.Id, _DataObjectProperty.DomainId,
            _DataObjectProperty.Remarks, _DataObjectProperty.RoleCode,
            _DataObjectProperty.RoleName, _DataObjectProperty.RoleType,
            _DataObjectProperty.Status, _DataObjectProperty.DefaultFlag,
            _DataObjectProperty.ModifyTime, _DataObjectProperty.OperatorId,
            _DataObjectProperty.OperatorName, _DataObjectProperty.DomainTitleKey,
            _DataObjectProperty.DomainName, _DataObjectProperty.DomainCode,
            _DataObjectProperty.DomainSortIndex, _DataObjectProperty.DomainIcon
        };
    public static final String[] ENTITY_PK_FIELDS = new String[] { Id };
    public static final String[] ENTITY_AUTO_GEN_PK_FIELDS = new String[] { Id };
    public static final String[] ENTITY_UNIQUE_FIELDS = new String[] {  };
    private static String relatedJoinSQL = null;
    private static String basicFilterSQL = null;
    private DataAccessObjectHelper<SysRole, SysRoleDAOQueryBean> daoHelper;
    private com.ourteam.system.dao.impl.AbstractSysRoleRelateDAOJdbcImpl SysRoleRelateDao;
    private com.ourteam.system.dao.impl.AbstractSysRoleResourceRelateDAOJdbcImpl SysRoleResourceRelateDao;

    public AbstractSysRoleDAOJdbcImpl() {
        super();
        daoHelper = new DataAccessObjectHelper<SysRole, SysRoleDAOQueryBean>(this);
    }

    protected String getEntityName() {
        return EntityName;
    }

    protected String[] getEntityFields() {
        return ENTITY_FIELDS;
    }

    protected String[] getEntityProperties() {
        return ENTITY_PROPERTIES;
    }

    protected String[] getEntityPKFields() {
        return ENTITY_PK_FIELDS;
    }

    protected String[] getEntityAutoGenPKFields() {
        return ENTITY_AUTO_GEN_PK_FIELDS;
    }

    protected String[] getEntityUniqueFields() {
        return ENTITY_UNIQUE_FIELDS;
    }

    protected String getBaiscQueryFilter() {
        if (basicFilterSQL == null) {
            StringBuffer basicFilterSQLbuffer = new StringBuffer();

            basicFilterSQLbuffer.append(RoleType).append("= 'ROLE' ");

            basicFilterSQLbuffer.append(" AND ");

            basicFilterSQLbuffer.append(Status).append("= 'active' ");

            basicFilterSQL = basicFilterSQLbuffer.toString();
        }

        return basicFilterSQL;
    }

    protected String getRelatedJoinSQL() {
        if (relatedJoinSQL == null) {
            StringBuffer relatedJoinSQLBuffer = new StringBuffer();

            relatedJoinSQLBuffer.append(" LEFT JOIN ")
                                .append(com.ourteam.system.dao.ISysUserDAO.EntityName)
                                .append(" operator_user ");

            relatedJoinSQLBuffer.append(" ON ( ");

            relatedJoinSQLBuffer.append(StringUtils.replace(
                    com.ourteam.system.dao.ISysUserDAO.Id,
                    com.ourteam.system.dao.ISysUserDAO.EntityName + ".",
                    "operator_user."));
            relatedJoinSQLBuffer.append(" = ").append(OperatorId);

            relatedJoinSQLBuffer.append(" ) ");

            relatedJoinSQLBuffer.append(" LEFT JOIN ")
                                .append(com.ourteam.system.dao.ISysDomainDAO.EntityName)
                                .append(" SYS_DOMAIN ");

            relatedJoinSQLBuffer.append(" ON ( ");

            relatedJoinSQLBuffer.append(StringUtils.replace(
                    com.ourteam.system.dao.ISysDomainDAO.Id,
                    com.ourteam.system.dao.ISysDomainDAO.EntityName + ".",
                    "SYS_DOMAIN."));
            relatedJoinSQLBuffer.append(" = ").append(DomainId);

            relatedJoinSQLBuffer.append(" ) ");

            relatedJoinSQL = relatedJoinSQLBuffer.toString();
        }

        return relatedJoinSQL;
    }

    /**
         * Check Data Unique
         * @param aSysRole
         * @throws Exception
         */
    public boolean checkIsUnique(SysRole aSysRole) throws Exception {
        if (aSysRole == null) {
            return true;
        }

        List valueList = new ArrayList();

        List pkValueList = new ArrayList();

        pkValueList.add(aSysRole.getId());

        return isUnique(valueList.toArray(new Object[valueList.size()]),
            pkValueList.toArray(new Object[pkValueList.size()]));
    }

    /**
     * Insert Data
     * @param aSysRole
     * @throws Exception
     */
    public void insert(SysRole aSysRole) throws Exception {
        PropertyUtils.setProperty(aSysRole, _DataObjectProperty.RoleType,
            org.apache.commons.beanutils.ConvertUtils.convert("ROLE",
                String.class));

        PropertyUtils.setProperty(aSysRole, _DataObjectProperty.Status,
            org.apache.commons.beanutils.ConvertUtils.convert("active",
                String.class));

        super.doInsert(aSysRole);
    }

    /**
         * Batch Insert Datas
         * @param aSysRole
         * @throws Exception
         */
    public void batchInsert(SysRole[] aSysRoles) throws Exception {
        super.doBatchInsert(aSysRoles);
    }

    /**
         * Delete Data
         * @param  final long id         *
         * @throws Exception
         */
    public void delete(final long id) throws Exception {
        SysRole tempSysRole = findById(id);

        PropertyUtils.setProperty(tempSysRole, _DataObjectProperty.Status,
            org.apache.commons.beanutils.ConvertUtils.convert("deactive",
                String.class));

        update(tempSysRole);
    }

    /**
     * Delete Datas
     * @param queryBean
     * @throws Exception
     */
    public void delete(SysRoleDAOQueryBean queryBean) throws Exception {
        SysRole tempSysRole = new SysRole();

        PropertyUtils.setProperty(tempSysRole, _DataObjectProperty.Status,
            org.apache.commons.beanutils.ConvertUtils.convert("deactive",
                String.class));

        update(tempSysRole, queryBean);
    }

    public void delete(SysRole aSysRole) throws Exception {
        delete(aSysRole.getId());
    }

    /**
     * Update Data Selective
     * @param aSysRole
     * @throws Exception
     */
    public void update(SysRole aSysRole) throws Exception {
        if (aSysRole.getId() == 0) {
            throw new Exception(
                "Can not update object data whith out primary key value");
        }

        super.doUpdate(aSysRole);

        SysRole tempObj = findById(aSysRole.getId());

        if (tempObj != null) {
            PropertyUtils.copyProperties(aSysRole, tempObj);
        }
    }

    /**
     * Batch Update Datas
     * @param aSysRoles[]
     * @throws Exception
     */
    public void batchUpdate(SysRole[] aSysRoles) throws Exception {
        super.doBatchUpdate(aSysRoles);
    }

    /**
         * Update Data By Condictions
         * @param aSysRole
         * @param aValueCriteria
         * @param aTransaction
         * @throws Exception
         */
    public void update(SysRole aSysRole, SysRoleDAOQueryBean aQueryBean)
        throws Exception {
        super.doUpdateByQuery(aSysRole, aQueryBean);
    }

    /**
     * Update Data By Condictions
     * @param aQueryBean
     * @throws Exception
     */
    public void update(SysRoleDAOQueryBean aQueryBean)
        throws Exception {
        super.doUpdateByQuery(aQueryBean);
    }

    protected void checkNullValue(SysRole aSysRole) throws Exception {
        if (aSysRole.getDefaultFlag() == null) {
            throw new Exception(
                "The SysRole.defaultFlag value is not allow NULL");
        }

        if (aSysRole.getDomainIcon() == null) {
            throw new Exception(
                "The SysRole.domainIcon value is not allow NULL");
        }

        if (aSysRole.getModifyTime() == null) {
            throw new Exception(
                "The SysRole.modifyTime value is not allow NULL");
        }

        if (aSysRole.getOperatorName() == null) {
            throw new Exception(
                "The SysRole.operatorName value is not allow NULL");
        }

        if (aSysRole.getRemarks() == null) {
            throw new Exception("The SysRole.remarks value is not allow NULL");
        }

        if (aSysRole.getRoleName() == null) {
            throw new Exception("The SysRole.roleName value is not allow NULL");
        }

        if (aSysRole.getStatus() == null) {
            throw new Exception("The SysRole.status value is not allow NULL");
        }
    }

    /**
     * Get Data By ID
     * @param  final long id         * @return  ${businessObject.name}
     * @throws Exception
     */
    public SysRole findById(final long id) throws Exception {
        SysRoleDAOQueryBean queryBean = new SysRoleDAOQueryBean();

        SysRoleDAOQueryBean.Criteria criteria = queryBean.createCriteria();

        criteria.andIdEqualTo(id);

        //queryBean.setDistinct(true);
        SysRole[] SysRoles = query(queryBean);

        if (SysRoles.length == 0) {
            return null;
        } else {
            return SysRoles[0];
        }
    }

    /**
         * Query Data
         * @param queryBean
         * @return SysRole[]
         * @throws Exception
         */
    public SysRole[] query(SysRoleDAOQueryBean queryBean)
        throws Exception {
        List result = super.doQuery(queryBean, new JdbcSysRoleRowMapper());

        return (SysRole[]) result.toArray(new SysRole[result.size()]);
    }

    /**
     * Query ${businessObject.name} Selective
     * @param queryBean
     * @return Map[]
     * @model
     * @throws Exception
     */
    public Map<String, Object>[] querySelective(SysRoleDAOQueryBean queryBean)
        throws Exception {
        if (queryBean.getSelectProperties().isEmpty()) {
            queryBean.addAllSelectProperties();
        }

        return super.doQuerySelective(queryBean);
    }

    /**
     * Query Data Count
     * @param queryBean
     * @return int
     * @throws Exception
     */
    public int queryCount(SysRoleDAOQueryBean queryBean)
        throws Exception {
        return super.doQueryCount(queryBean);
    }

    public void synchronize(SysRole[] aSysRoles, SysRoleDAOQueryBean queryBean)
        throws Exception {
        daoHelper.synchronize(aSysRoles, queryBean);
    }

    public void synchronize(SysRole[] aSysRoles, SysRoleDAOQueryBean queryBean,
        net.dao.IDataAccessInterface.ISynchronizeCallback<SysRole> callBack)
        throws Exception {
        daoHelper.synchronize(aSysRoles, queryBean, callBack);
    }

    public void setSysRoleRelateDao(
        com.ourteam.system.dao.ISysRoleRelateDAO SysRoleRelateDao) {
        this.SysRoleRelateDao = (com.ourteam.system.dao.impl.AbstractSysRoleRelateDAOJdbcImpl) SysRoleRelateDao;
    }

    /**
     * Query Related SysRoleRelate
    * @param queryBean
     * @throws Exception
     */
    public com.ourteam.system.dao.SysRoleRelate[] querySysRoleRelate(
        SysRoleDAOQueryBean queryBean) throws Exception {
        StringBuffer joinSQL = new StringBuffer();

        joinSQL.append(" LEFT JOIN ").append(EntityName).append(" ON ( ");

        joinSQL.append(com.ourteam.system.dao.ISysRoleRelateDAO.SysRoleGroupId)
               .append(" = ").append(Id);

        joinSQL.append(" ) ");

        String entityName = com.ourteam.system.dao.impl.SysRoleRelateDAO.EntityName +
            " ref_SysRoleRelate";

        String[] entityFields = com.ourteam.system.dao.impl.SysRoleRelateDAO.ENTITY_FIELDS;

        String[] entityProperties = com.ourteam.system.dao.impl.SysRoleRelateDAO.ENTITY_PROPERTIES;

        List list = SysRoleRelateDao.doQuery(entityName, entityFields,
                entityProperties, queryBean, joinSQL.toString(),
                new com.ourteam.system.dao.impl.SysRoleRelateDAO.JdbcSysRoleRelateRowMapper());

        return (com.ourteam.system.dao.SysRoleRelate[]) list.toArray(new com.ourteam.system.dao.SysRoleRelate[list.size()]);
    }

    /**
     * Query Related SysRoleRelate Selective
     * @param queryBean
     * @return Map[]
     * @model
     * @throws Exception
     */
    public Map<String, Object>[] querySysRoleRelateSelective(
        SysRoleDAOQueryBean queryBean) throws Exception {
        if (queryBean.getSelectProperties().isEmpty()) {
            queryBean.addSelectProperty(com.ourteam.system.dao.ISysRoleRelateDAO.Id,
                "id");

            queryBean.addSelectProperty(com.ourteam.system.dao.ISysRoleRelateDAO.RelatedSysRoleId,
                "relatedSysRoleId");

            queryBean.addSelectProperty(com.ourteam.system.dao.ISysRoleRelateDAO.Remarks,
                "remarks");

            queryBean.addSelectProperty(com.ourteam.system.dao.ISysRoleRelateDAO.Status,
                "status");

            queryBean.addSelectProperty(com.ourteam.system.dao.ISysRoleRelateDAO.SysRoleGroupId,
                "sysRoleGroupId");

            queryBean.addSelectProperty(com.ourteam.system.dao.ISysRoleRelateDAO.RelatedSysRoleCode,
                "relatedSysRoleCode");
        }

        StringBuffer joinSQL = new StringBuffer();

        joinSQL.append(" LEFT JOIN ").append(EntityName).append(" ON ( ");

        joinSQL.append(com.ourteam.system.dao.ISysRoleRelateDAO.SysRoleGroupId)
               .append(" = ").append(Id);

        joinSQL.append(" ) ");

        String entityName = com.ourteam.system.dao.impl.SysRoleRelateDAO.EntityName +
            " ref_SysRoleRelate";

        return SysRoleRelateDao.doQuerySelective(entityName, queryBean,
            joinSQL.toString());
    }

    /**
     * Update Related SysRoleRelate
     * @param aSysRoleRelate
     * @param aQueryBean
     * @model
     * @throws Exception
     */
    public void updateSysRoleRelate(
        com.ourteam.system.dao.SysRoleRelate aSysRoleRelate,
        SysRoleDAOQueryBean aQueryBean) throws Exception {
        StringBuffer joinSQL = new StringBuffer();

        joinSQL.append(" LEFT JOIN ").append(EntityName).append(" ON ( ");

        joinSQL.append(com.ourteam.system.dao.ISysRoleRelateDAO.SysRoleGroupId)
               .append(" = ").append(Id);

        joinSQL.append(" ) ");

        String entityName = com.ourteam.system.dao.impl.SysRoleRelateDAO.EntityName +
            " ref_SysRoleRelate";

        String[] entityFields = com.ourteam.system.dao.impl.SysRoleRelateDAO.ENTITY_FIELDS;

        String[] entityProperties = com.ourteam.system.dao.impl.SysRoleRelateDAO.ENTITY_PROPERTIES;

        SysRoleRelateDao.doUpdateByQuery(entityName, entityFields,
            entityProperties, joinSQL.toString(), aSysRoleRelate, aQueryBean);
    }

    /**
     * Delete Related SysRoleRelate
     * @param aQueryBean
     * @model
     * @throws Exception
     */
    public void deleteSysRoleRelate(SysRoleDAOQueryBean aQueryBean)
        throws Exception {
        StringBuffer joinSQL = new StringBuffer();

        joinSQL.append(" LEFT JOIN ").append(EntityName).append(" ON ( ");

        joinSQL.append(com.ourteam.system.dao.ISysRoleRelateDAO.SysRoleGroupId)
               .append(" = ").append(Id);

        joinSQL.append(" ) ");

        String entityName = com.ourteam.system.dao.impl.SysRoleRelateDAO.EntityName; // + " ref_SysRoleRelate";

        SysRoleRelateDao.doDeleteByQuery(entityName, joinSQL.toString(),
            aQueryBean);
    }

    public void setSysRoleResourceRelateDao(
        com.ourteam.system.dao.ISysRoleResourceRelateDAO SysRoleResourceRelateDao) {
        this.SysRoleResourceRelateDao = (com.ourteam.system.dao.impl.AbstractSysRoleResourceRelateDAOJdbcImpl) SysRoleResourceRelateDao;
    }

    /**
     * Query Related SysRoleResourceRelate
    * @param queryBean
     * @throws Exception
     */
    public com.ourteam.system.dao.SysRoleResourceRelate[] querySysRoleResourceRelate(
        SysRoleDAOQueryBean queryBean) throws Exception {
        StringBuffer joinSQL = new StringBuffer();

        joinSQL.append(" LEFT JOIN ").append(EntityName).append(" ON ( ");

        joinSQL.append(com.ourteam.system.dao.ISysRoleResourceRelateDAO.SysRoleId)
               .append(" = ").append(Id);

        joinSQL.append(" ) ");

        String entityName = com.ourteam.system.dao.impl.SysRoleResourceRelateDAO.EntityName +
            " ref_SysRoleResourceRelate";

        String[] entityFields = com.ourteam.system.dao.impl.SysRoleResourceRelateDAO.ENTITY_FIELDS;

        String[] entityProperties = com.ourteam.system.dao.impl.SysRoleResourceRelateDAO.ENTITY_PROPERTIES;

        List list = SysRoleResourceRelateDao.doQuery(entityName, entityFields,
                entityProperties, queryBean, joinSQL.toString(),
                new com.ourteam.system.dao.impl.SysRoleResourceRelateDAO.JdbcSysRoleResourceRelateRowMapper());

        return (com.ourteam.system.dao.SysRoleResourceRelate[]) list.toArray(new com.ourteam.system.dao.SysRoleResourceRelate[list.size()]);
    }

    /**
     * Query Related SysRoleResourceRelate Selective
     * @param queryBean
     * @return Map[]
     * @model
     * @throws Exception
     */
    public Map<String, Object>[] querySysRoleResourceRelateSelective(
        SysRoleDAOQueryBean queryBean) throws Exception {
        if (queryBean.getSelectProperties().isEmpty()) {
            queryBean.addSelectProperty(com.ourteam.system.dao.ISysRoleResourceRelateDAO.Id,
                "id");

            queryBean.addSelectProperty(com.ourteam.system.dao.ISysRoleResourceRelateDAO.RelateCode,
                "relateCode");

            queryBean.addSelectProperty(com.ourteam.system.dao.ISysRoleResourceRelateDAO.RelateName,
                "relateName");

            queryBean.addSelectProperty(com.ourteam.system.dao.ISysRoleResourceRelateDAO.Remarks,
                "remarks");

            queryBean.addSelectProperty(com.ourteam.system.dao.ISysRoleResourceRelateDAO.Status,
                "status");

            queryBean.addSelectProperty(com.ourteam.system.dao.ISysRoleResourceRelateDAO.SysResourceId,
                "sysResourceId");

            queryBean.addSelectProperty(com.ourteam.system.dao.ISysRoleResourceRelateDAO.SysRoleId,
                "sysRoleId");
        }

        StringBuffer joinSQL = new StringBuffer();

        joinSQL.append(" LEFT JOIN ").append(EntityName).append(" ON ( ");

        joinSQL.append(com.ourteam.system.dao.ISysRoleResourceRelateDAO.SysRoleId)
               .append(" = ").append(Id);

        joinSQL.append(" ) ");

        String entityName = com.ourteam.system.dao.impl.SysRoleResourceRelateDAO.EntityName +
            " ref_SysRoleResourceRelate";

        return SysRoleResourceRelateDao.doQuerySelective(entityName, queryBean,
            joinSQL.toString());
    }

    /**
     * Update Related SysRoleResourceRelate
     * @param aSysRoleResourceRelate
     * @param aQueryBean
     * @model
     * @throws Exception
     */
    public void updateSysRoleResourceRelate(
        com.ourteam.system.dao.SysRoleResourceRelate aSysRoleResourceRelate,
        SysRoleDAOQueryBean aQueryBean) throws Exception {
        StringBuffer joinSQL = new StringBuffer();

        joinSQL.append(" LEFT JOIN ").append(EntityName).append(" ON ( ");

        joinSQL.append(com.ourteam.system.dao.ISysRoleResourceRelateDAO.SysRoleId)
               .append(" = ").append(Id);

        joinSQL.append(" ) ");

        String entityName = com.ourteam.system.dao.impl.SysRoleResourceRelateDAO.EntityName +
            " ref_SysRoleResourceRelate";

        String[] entityFields = com.ourteam.system.dao.impl.SysRoleResourceRelateDAO.ENTITY_FIELDS;

        String[] entityProperties = com.ourteam.system.dao.impl.SysRoleResourceRelateDAO.ENTITY_PROPERTIES;

        SysRoleResourceRelateDao.doUpdateByQuery(entityName, entityFields,
            entityProperties, joinSQL.toString(), aSysRoleResourceRelate,
            aQueryBean);
    }

    /**
     * Delete Related SysRoleResourceRelate
     * @param aQueryBean
     * @model
     * @throws Exception
     */
    public void deleteSysRoleResourceRelate(SysRoleDAOQueryBean aQueryBean)
        throws Exception {
        StringBuffer joinSQL = new StringBuffer();

        joinSQL.append(" LEFT JOIN ").append(EntityName).append(" ON ( ");

        joinSQL.append(com.ourteam.system.dao.ISysRoleResourceRelateDAO.SysRoleId)
               .append(" = ").append(Id);

        joinSQL.append(" ) ");

        String entityName = com.ourteam.system.dao.impl.SysRoleResourceRelateDAO.EntityName; // + " ref_SysRoleResourceRelate";

        SysRoleResourceRelateDao.doDeleteByQuery(entityName,
            joinSQL.toString(), aQueryBean);
    }

    public static class JdbcSysRoleRowMapper implements RowMapper<SysRole> {
        public SysRole mapRow(ResultSet resultSet, int arg1)
            throws SQLException {
            SysRole object = new SysRole();

            int columnIndex = 1;

            int __dataType;

            try {
                Object id = null;

                id = resultSet.getObject(columnIndex++);

                object.setIdNull(resultSet.getBoolean(columnIndex++));

                if (id != null) {
                    setBeanValue(object, _DataObjectProperty.Id, id);
                }

                Object domainId = null;

                domainId = resultSet.getObject(columnIndex++);

                object.setDomainIdNull(resultSet.getBoolean(columnIndex++));

                if (domainId != null) {
                    setBeanValue(object, _DataObjectProperty.DomainId, domainId);
                }

                Object remarks = null;

                remarks = resultSet.getObject(columnIndex++);

                object.setRemarksNull(resultSet.getBoolean(columnIndex++));

                if (remarks != null) {
                    setBeanValue(object, _DataObjectProperty.Remarks, remarks);
                }

                Object roleCode = null;

                roleCode = resultSet.getObject(columnIndex++);

                object.setRoleCodeNull(resultSet.getBoolean(columnIndex++));

                if (roleCode != null) {
                    setBeanValue(object, _DataObjectProperty.RoleCode, roleCode);
                }

                Object roleName = null;

                roleName = resultSet.getObject(columnIndex++);

                object.setRoleNameNull(resultSet.getBoolean(columnIndex++));

                if (roleName != null) {
                    setBeanValue(object, _DataObjectProperty.RoleName, roleName);
                }

                Object roleType = null;

                roleType = resultSet.getObject(columnIndex++);

                object.setRoleTypeNull(resultSet.getBoolean(columnIndex++));

                if (roleType != null) {
                    setBeanValue(object, _DataObjectProperty.RoleType, roleType);
                }

                Object status = null;

                status = resultSet.getObject(columnIndex++);

                object.setStatusNull(resultSet.getBoolean(columnIndex++));

                if (status != null) {
                    setBeanValue(object, _DataObjectProperty.Status, status);
                }

                Object defaultFlag = null;

                defaultFlag = resultSet.getObject(columnIndex++);

                object.setDefaultFlagNull(resultSet.getBoolean(columnIndex++));

                if (defaultFlag != null) {
                    setBeanValue(object, _DataObjectProperty.DefaultFlag,
                        defaultFlag);
                }

                Object modifyTime = null;

                __dataType = resultSet.getMetaData().getColumnType(columnIndex);

                if ((__dataType == java.sql.Types.DATE) ||
                        (__dataType == java.sql.Types.TIME) ||
                        (__dataType == java.sql.Types.TIMESTAMP)) {
                    modifyTime = resultSet.getTimestamp(columnIndex++);
                } else {
                    modifyTime = resultSet.getObject(columnIndex++);
                }

                object.setModifyTimeNull(resultSet.getBoolean(columnIndex++));

                if (modifyTime != null) {
                    setBeanValue(object, _DataObjectProperty.ModifyTime,
                        modifyTime);
                }

                Object operatorId = null;

                operatorId = resultSet.getObject(columnIndex++);

                object.setOperatorIdNull(resultSet.getBoolean(columnIndex++));

                if (operatorId != null) {
                    setBeanValue(object, _DataObjectProperty.OperatorId,
                        operatorId);
                }

                Object operatorName = null;

                operatorName = resultSet.getObject(columnIndex++);

                object.setOperatorNameNull(resultSet.getBoolean(columnIndex++));

                if (operatorName != null) {
                    setBeanValue(object, _DataObjectProperty.OperatorName,
                        operatorName);
                }

                Object domainTitleKey = null;

                domainTitleKey = resultSet.getObject(columnIndex++);

                object.setDomainTitleKeyNull(resultSet.getBoolean(columnIndex++));

                if (domainTitleKey != null) {
                    setBeanValue(object, _DataObjectProperty.DomainTitleKey,
                        domainTitleKey);
                }

                Object domainName = null;

                domainName = resultSet.getObject(columnIndex++);

                object.setDomainNameNull(resultSet.getBoolean(columnIndex++));

                if (domainName != null) {
                    setBeanValue(object, _DataObjectProperty.DomainName,
                        domainName);
                }

                Object domainCode = null;

                domainCode = resultSet.getObject(columnIndex++);

                object.setDomainCodeNull(resultSet.getBoolean(columnIndex++));

                if (domainCode != null) {
                    setBeanValue(object, _DataObjectProperty.DomainCode,
                        domainCode);
                }

                Object domainSortIndex = null;

                domainSortIndex = resultSet.getObject(columnIndex++);

                object.setDomainSortIndexNull(resultSet.getBoolean(
                        columnIndex++));

                if (domainSortIndex != null) {
                    setBeanValue(object, _DataObjectProperty.DomainSortIndex,
                        domainSortIndex);
                }

                Object domainIcon = null;

                domainIcon = resultSet.getObject(columnIndex++);

                object.setDomainIconNull(resultSet.getBoolean(columnIndex++));

                if (domainIcon != null) {
                    setBeanValue(object, _DataObjectProperty.DomainIcon,
                        domainIcon);
                }

                return object;
            } catch (Exception e) {
                throw new SQLException(e.getMessage());
            }
        }
    }
}
